package com.aifast.system.sys.entity;

import com.aifast.common.base.BaseEntity;
import com.aifast.common.dict.DictBind;
import com.aifast.common.dict.DictBindType;
import com.aifast.common.dict.DictFormatType;
import com.aifast.common.fieldEncrypt.Algorithm;
import com.aifast.common.fieldEncrypt.FieldEncrypt;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.List;

/**
 * <p>
 * 用户
 * </p>
 *
 * @author fujian
 * @since 2022-01-07
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@TableName("sys_user")
public class SysUser extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 账号
     */
    private String username;

    /**
     * 密码
     */
    @FieldEncrypt(type = Algorithm.MD5_16)
    private String password;

    /**
     * 账户名
     */
    private String realName;

    /**
     * 手机号码
     */
    @FieldEncrypt
    private String phone;

    /**
     * 电子邮箱
     */
    private String email;

    /**
     * 机构id
     */
    @DictBind(tableName = "sys_org",columns = "full_name",mode = DictBindType.JOIN,target = "orgName")
    private Integer orgId;

    /**
     * 状态
     */
    private Integer state;

    /**
     * 头像
     */
    private String avatar;

    /**
     * 地址
     */
    private String address;
    /**
     * 个性标签
     */
    private String label;
    /**
     * 个人简介
     */
    private String remarks;

    private String admin;


    @TableField(exist = false)
    private List<SysRole> roles;

    /**
     * 租户id
     */
    private Integer tenantId;


}
